13. Adapter Pattern

ND079 JPND C2 L03 A14 Adapter Pattern

When Do We Use the Adapter Pattern?

You can use an adapter whenever you need to transform one API or interface into another. Adapters allow classes with otherwise incompatible interfaces to work together!

Adapters typically "wrap" an existing interface to adapt it to a different interface. One common use of the adapter pattern is to wrap legacy APIs, but adapters can be used with all sorts of APIs.

What's the main purpose of the adapter pattern?

SOLUTION: To transform one API into another API.